//    Copyright (C) Kherty.  All rights reserved.
#region

using System.Collections.Generic;
using System.Windows.Media;

#endregion

namespace OpenLS.Spreadsheet.UI
{
    public static class ConditionalFormattingRules
    {
        public static IEnumerable<DataBarFormattingRule> DataBars
        {
            get
            {
                foreach (string s in new[]
                                         {
                                             "#FF638EC6",
                                             "#FF63C384",
                                             "#FFFF555A",
                                             "#FFFFB628",
                                             "#FF008AEF",
                                             "#FFD6007B",
                                         }
                    )
                {
                    var c = (Color) (new ColorConverter().ConvertFromString(null, s));
                    yield return new DataBarFormattingRule(new RgbColor(c));
                }
            }
        }

        private static SpreadsheetColor GetColor(string s)
        {
            return new RgbColor((Color) new ColorConverter().ConvertFromString(null, s));
        }

        public static IEnumerable<ColorScaleFormattingRule> ColorScales
        {
            get
            {
                yield return new ColorScaleFormattingRule(GetColor("#FFF8696B"),
                                                          GetColor("#FFFFEB84"),
                                                          GetColor("#FF63BE7B"));
                yield return new ColorScaleFormattingRule(GetColor("#FF63BE7B"),
                                                          GetColor("#FFFFEB84"),
                                                          GetColor("#FFF8696B"));
                yield return new ColorScaleFormattingRule(
                    GetColor("#FFF8696B"),
                    GetColor("#FFFFEB84"),
                    GetColor("#FF5A8AC6"));

                yield return new ColorScaleFormattingRule(GetColor("#FF5A8AC6"),
                                                          GetColor("#FFFFEB84"),
                                                          GetColor("#FFF8696B"));


                yield return new ColorScaleFormattingRule(GetColor("#FFFF7128"),
                                                          GetColor("#FFFFEF9C"));

                yield return new ColorScaleFormattingRule(GetColor("#FFFFEF9C"),
                                                          GetColor("#FFFF7128"));

                yield return new ColorScaleFormattingRule(GetColor("#FFFFEF9C"),
                                                          GetColor("#FF63BE7B"));

                yield return new ColorScaleFormattingRule(GetColor("#FF63BE7B"),
                                                          GetColor("#FFFFEF9C"));
            }
        }
    }
}